create or replace view vac_page_process_4_1 as
with pp as
(
select
 workspace,
 application_id,
 application_name,
 page_id,
 page_name,
 process_name,
 to_char(execution_sequence) execution_sequence,
 to_char(process_point) process_point,
 process_point_code,
 process_type,
 process_type_code,
 runtime_where_clause,
 ac_utils.hs(process_source) process_hs,
 dbms_lob.substr(process_source,4000, 1)        process_sr1,
 dbms_lob.substr(process_source,4000, 4000+1 )  process_sr2,
 dbms_lob.substr(process_source,4000, 8000+1 )  process_sr3,
 dbms_lob.substr(process_source,4000, 12000+1)  process_sr4,
-- process_source,
 attribute_01,
 attribute_02,
 attribute_03,
 attribute_04,
 attribute_05,
 attribute_06,
 attribute_07,
 attribute_08,
 attribute_09,
 attribute_10,
 process_error_message,
 when_button_pressed,
 when_button_pressed_id,
 condition_type,
 condition_type_code,
 condition_expression1,
 condition_expression2,
 run_process,
 return_key_into_item_1,
 return_key_into_item_2,
 success_message,
 build_option,
 authorization_scheme,
 authorization_scheme_id,
 last_updated_by,
 last_updated_on,
 component_comment,
 process_id,
 component_signature
from APEX_APPLICATION_PAGE_PROC
)
select
 workspace,
 application_id,
 application_name,
 process_point,
 process_point_code,
 process_point ||' seq:'|| execution_sequence process_msg,
 execution_sequence,
 page_id,
 page_name,
 to_clob(process_sr1) || to_clob(process_sr2)
 || to_clob(process_sr3) || to_clob(process_sr4)  process_sr,
 process_id,
 authorization_scheme_id,
 when_button_pressed_id,
 last_updated_by,
 last_updated_on,
 u_value,
 u_name,
 'APEX_APPLICATION_PAGE_PROC' src_view_name
from pp
 UNPIVOT INCLUDE NULLS ( u_value
   FOR    u_name
   IN
   (
     process_name,
     process_type,
     process_type_code,
     runtime_where_clause,
     process_hs,
--     process_source,
     attribute_01,
     attribute_02,
     attribute_03,
     attribute_04,
     attribute_05,
     attribute_06,
     attribute_07,
     attribute_08,
     attribute_09,
     attribute_10,
     process_error_message,
     when_button_pressed,
     condition_type,
     condition_type_code,
     condition_expression1,
     condition_expression2,
     run_process,
     return_key_into_item_1,
     return_key_into_item_2,
     success_message,
     build_option,
     authorization_scheme,
     component_comment
   )
);

